from .base import Object, Set
from .constants import constant, Enum

class WdInlineShapeType(Enum):
    """ 指定内嵌形状的形状类型。

        WORD 中的 WDINLINESHAPETYPE (枚举)
        名称	                                    值	说明
        wdInlineShape3DModel	                    19	3D 模型。
        wdInlineShapeChart	                        12	内嵌图表。
        wdInlineShapeDiagram	                    13	内嵌关系图。
        wdInlineShapeEmbeddedOLEObject	            1	嵌入的 OLE 对象。
        wdInlineShapeHorizontalLine	                6	横线。
        wdInlineShapeLinked3DModel	                20	链接的 3D 模型。
        wdInlineShapeLinkedOLEObject	            2	链接的 OLE 对象。
        wdInlineShapeLinkedPicture	                4	链接的图片。
        wdInlineShapeLinkedPictureHorizontalLine	8	带有横线的链接图片。
        wdInlineShapeLockedCanvas	                14	锁定的内嵌形状画布。
        wdInlineShapeOLEControlObject	            5	OLE 控件对象。
        wdInlineShapeOWSAnchor	                    11	OWS 锁定标记。
        wdInlineShapePicture	                    3	图片。
        wdInlineShapePictureBullet	                9	用作项目符号的图片。
        wdInlineShapePictureHorizontalLine	        7	带有横线的图片。
        wdInlineShapeScriptAnchor	                10	脚本定位标记。 指与文档一起存储的脚本块的定位标记位置。
        wdInlineShapeSmartArt	                    15	SmartArt 图形。
        wdInlineShapeWebVideo	                    16	作为海报帧视频网站的图片。
    """
    wdInlineShape3DModel = constant('wdInlineShape3DModel')
    wdInlineShapeChart = constant('wdInlineShapeChart')
    wdInlineShapeDiagram = constant('wdInlineShapeDiagram')
    wdInlineShapeEmbeddedOLEObject = constant('wdInlineShapeEmbeddedOLEObject')
    wdInlineShapeHorizontalLine = constant('wdInlineShapeHorizontalLine')
    wdInlineShapeLinked3DModel = constant('wdInlineShapeLinked3DModel')
    wdInlineShapeLinkedOLEObject = constant('wdInlineShapeLinkedOLEObject')
    wdInlineShapeLinkedPicture = constant('wdInlineShapeLinkedPicture')
    wdInlineShapeLinkedPictureHorizontalLine = constant('wdInlineShapeLinkedPictureHorizontalLine')
    wdInlineShapeLockedCanvas = constant('wdInlineShapeLockedCanvas')
    wdInlineShapeOLEControlObject = constant('wdInlineShapeOLEControlObject')
    wdInlineShapeOWSAnchor = constant('wdInlineShapeOWSAnchor')
    wdInlineShapePicture = constant('wdInlineShapePicture')
    wdInlineShapePictureBullet = constant('wdInlineShapePictureBullet')
    wdInlineShapePictureHorizontalLine = constant('wdInlineShapePictureHorizontalLine')
    wdInlineShapeScriptAnchor = constant('wdInlineShapeScriptAnchor')
    wdInlineShapeSmartArt = constant('wdInlineShapeSmartArt')
    wdInlineShapeWebVideo = constant('wdInlineShapeWebVideo')


class InlineShape(Object):
    """ InlineShape 对象

        properties
        ==========
        AlternativeText
        Application
        Borders
        Chart
        Creator
        Field
        Fill
        Glow
        GroupItems
        HasChart
        HasSmartArt
        Height
        HorizontalLineFormat
        Hyperlink
        IsPictureBullet
        Line
        LinkFormat
        LockAspectRatio
        OLEFormat
        Parent
        PictureFormat
        Range
        Reflection
        ScaleHeight
        ScaleWidth
        Script
        Shadow
        SmartArt
        SoftEdge
        TextEffect
        Title
        Type
        Width

    """

    # properties
    @property
    def AlternativeText(self):
        return self.Instance.AlternativeText

    @property
    def Application(self):
        return self.Instance.Application

    @property
    def Borders(self):
        return self.Instance.Borders

    @property
    def Chart(self):
        return self.Instance.Chart

    @property
    def Creator(self):
        return self.Instance.Creator

    @property
    def Field(self):
        return self.Instance.Field

    @property
    def Fill(self):
        return self.Instance.Fill

    @property
    def Glow(self):
        return self.Instance.Glow

    @property
    def GroupItems(self):
        return self.Instance.GroupItems

    @property
    def HasChart(self):
        return self.Instance.HasChart

    @property
    def HasSmartArt(self):
        return self.Instance.HasSmartArt

    @property
    def Height(self):
        return self.Instance.Height

    @property
    def HorizontalLineFormat(self):
        return self.Instance.HorizontalLineFormat

    @property
    def Hyperlink(self):
        return self.Instance.Hyperlink

    @property
    def IsPictureBullet(self):
        return self.Instance.IsPictureBullet

    @property
    def Line(self):
        return self.Instance.Line

    @property
    def LinkFormat(self):
        return self.Instance.LinkFormat

    @property
    def LockAspectRatio(self):
        return self.Instance.LockAspectRatio

    @property
    def OLEFormat(self):
        return self.Instance.OLEFormat

    @property
    def Parent(self):
        return self.Instance.Parent

    @property
    def PictureFormat(self):
        return self.Instance.PictureFormat

    @property
    def Range(self):
        return self.Instance.Range

    @property
    def Reflection(self):
        return self.Instance.Reflection

    @property
    def ScaleHeight(self):
        return self.Instance.ScaleHeight

    @property
    def ScaleWidth(self):
        return self.Instance.ScaleWidth

    @property
    def Script(self):
        return self.Instance.Script

    @property
    def Shadow(self):
        return self.Instance.Shadow

    @property
    def SmartArt(self):
        return self.Instance.SmartArt

    @property
    def SoftEdge(self):
        return self.Instance.SoftEdge

    @property
    def TextEffect(self):
        return self.Instance.TextEffect

    @property
    def Title(self):
        return self.Instance.Title

    @property
    def Type(self) -> WdInlineShapeType:
        return WdInlineShapeType(self.Instance.Type)

    @property
    def Width(self):
        return self.Instance.Width

    # methods
    def ConvertToShape(self):
        self.Instance.ConvertToShape()

    def Delete(self):
        self.Instance.Delete()

    def Reset(self):
        self.Instance.Reset()

    def Select(self):
        self.Instance.Select()

    def saveobj(self):
        return {
            'Class': 'InlineShape',
            'Type': self.Type
        }


class InlineShapes(Set):
    def __init__(self, instance):
        super().__init__(instance, InlineShape)
